package com.jk.controller;

import com.jk.pojo.RecordBean;
import com.jk.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @ClassName RecordController
 * @Descripttion TODO   服务记录和签约记录Controller
 * @Author DELL
 * @Date 2022/10/12 20:07
 * @Version 0.001
 */
@RestController
@RequestMapping("record")
public class RecordController {

    @Autowired
    private RecordService recordService;


    /**
    * @Author: binzi
    * @Description:查询服务
    * @Date: 2022/10/12 20:18
    * @Return: java.util.Map
    **/
    @RequestMapping("findRecord")
    public Map findRecord(RecordBean recordBean){
        return recordService.findRecord(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:查询服务 状态为1的
    * @Date: 2022/10/23 19:18
    * @Return: java.util.Map
    **/
    @RequestMapping("findRecord1")
    public Map findRecord1(RecordBean recordBean){
        return recordService.findRecord1(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:查询服务 状态为2的
    * @Date: 2022/10/23 19:26
    * @Return: java.util.Map
    **/
    @RequestMapping("findRecord2")
    public Map findRecord2(RecordBean recordBean){
        return recordService.findRecord2(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:查询服务 状态为3的
    * @Date: 2022/10/23 20:15
    * @Return: java.util.Map
    **/
    @RequestMapping("findRecord3")
    public Map findRecord3(RecordBean recordBean){
        return recordService.findRecord3(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:查询服务 状态为3的
    * @Date: 2022/10/23 20:16
    * @Return: java.util.Map
    **/
    @RequestMapping("findRecord4")
    public Map findRecord4(RecordBean recordBean){
        return recordService.findRecord4(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:新增mysql同步到es中
    * @Date: 2022/10/13 11:34
    * @Return: void
    **/
    @RequestMapping("addRecord")
    public void addRecord(RecordBean recordBean){
        recordService.addRecord(recordBean);
    }

    /**
    * @Author: binzi
    * @Description:根据ID删除
    * @Date: 2022/10/13 16:12
    * @Return: boolean
    **/
    @RequestMapping("delRecordById")
    public boolean delRecordById(Integer record_id){
        return recordService.delRecordById(record_id);
    }

    /**
    * @Author: binzi
    * @Description:根据pid回显
    * @Date: 2022/10/13 17:22
    * @Return: com.jk.pojo.RecordBean
    **/
    @RequestMapping("findRecordByPid")
    public List<RecordBean> findRecordByPid(Integer pid){
        return recordService.findRecordByPid(pid);
    }

    /**
    * @Author: binzi
    * @Description:根据id(编号)回显
    * @Date: 2022/10/19 9:26
    * @Return: com.jk.pojo.RecordBean
    **/
    @RequestMapping("findRecordById")
    public RecordBean findRecordById(Integer record_id){
        return recordService.findRecordById(record_id);
    }

    /**
    * @Author: binzi
    * @Description:查询当前时间一周的数据
    * @Date: 2022/10/17 15:15
    * @Return: java.util.List<com.jk.pojo.RecordBean>
    **/
    @RequestMapping("findDateByWeek")
    public Map findDateByWeek(){
        return recordService.findDateByWeek();
    }


    /**
    * @Author: binzi
    * @Description:已完成服务数量
    * @Date: 2022/10/18 10:54
    * @Return: java.lang.Integer
    **/
    @RequestMapping("findRecordByStateCount")
    public Integer findRecordByStateCount(){
        return recordService.findRecordByStateCount();
    }
/**
 * @Author 邓金康
 * @Description //编辑修改哦
 * @Date  14:03
 * @param recordBean:
 * @return: void
 **/
    @RequestMapping("findRecordModify")
    public void  findRecordModify( RecordBean recordBean) throws IOException {
        recordService.findRecordModify(recordBean);
    }


    /**
    * @Author: binzi
    * @Description:根据id更改状态
    * @Date: 2022/10/23 19:34
    * @Return: void
    **/
    @RequestMapping("updateStateById")
    public void  updateStateById(Integer record_id) throws IOException {
        recordService.updateStateById(record_id);
    }

    /**
     * @Author: binzi
     * @Description:根据id更改状态
     * @Date: 2022/10/23 19:34
     * @Return: void
     **/
    @RequestMapping("updateStateById2")
    public void  updateStateById2(Integer record_id) throws IOException {
        recordService.updateStateById2(record_id);
    }

    /**
     * @Author: binzi
     * @Description:根据id更改状态 4
     * @Date: 2022/10/23 19:34
     * @Return: void
     **/
    @RequestMapping("updateStateById3")
    public void  updateStateById3(Integer record_id) throws IOException {
        recordService.updateStateById3(record_id);
    }
}
